# -*- coding: utf-8 -*

import os
path="e:/ref.txt"

file=open(path,"r")
strs=file.readlines()
file.close()
retlist=""    
for i in range(0,len(strs)-1):
    tmpstr=strs[i]
    for q in range(0,len(tmpstr)-1):
        if tmpstr[q]=="]":
            tmplist="["+str(i+1)+"]"+tmpstr[q+1:-1]+"\n"
            retlist+=tmplist
            break
file=open("e:/result.txt","w")
file.write(retlist)
file.close()
